<script>
function displayDetail(id)
{
	document.getElementById(id).style.display = "inline";
}
</script>
<H1>ADMIN Manage</H1>
<? if($func == 'user'): ?>
		<H3>User Manager</H3>
		<table><th>user</th><th>name</th><th>email</th>
		<? for($i=0; $i<count($listMember); $i++): ?>
				<tr>	
						<td><?=$listMember[$i]['name']?></td>
						<td><?=$listMember[$i]['fname']?></td>
						<td><?=$listMember[$i]['email']?></td>
						<td><a href="http://<?=$_SERVER['HTTP_HOST']?>/hotelbooking/index.php/backend/admin/user/del_<?=$listMember[$i]['id']?>">delete</a></td>
				</tr>
		<? endfor; ?>
		</table>
<? else: ?>
		<? 
			$temp_hotel_ID = $displayHotel[0]['hotel_id'];
			$temp_room_ID = $displayHotel[0]['rt_id'];
			$temp_member = $displayHotel[0]['mem_user'];
			$flag = false;
		?>

		
			<div>
					<!-- <span><a href="#" onclick="displayDetail('m_<?=$i?>');"><?=$listMember[$i]['name']?></a><span>
					<span id="m_<?=$i?>" style="display:none; "><?=$listMember[$i]['fname']?>&nbsp;<?=$listMember[$i]['email']?></span> -->
					<table border=1>
					<th>User</th><th>Hotel</th><th>Room type</th>
					
					<?php for($i=0; $i<count($displayHotel); $i++): ?>
							<tr>
									<td>
											<?=($i==0)?$listMember[$displayHotel[$i]['hotel_name']] : '' ?>
											<? if($displayHotel[$i]['mem_user'] != $temp_member): ?>
														<?=$listMember[$displayHotel[$i]['hotel_name']]?>
														<? $temp_member = $displayHotel[$i]['mem_user']; ?>
											<? endif; ?>
									</td>
									<td>
											<?=($i==0)? '<A HREF="http://'.$_SERVER["HTTP_HOST"].'/hotelbooking/index.php/backend/hotel/edit/'.$displayHotel[$i]["hotel_id"].'">'.$displayHotel[$i]["hotel_name"].'</A>' : '' ?>
											<? if($displayHotel[$i]['hotel_id'] != $temp_hotel_ID): ?>
													<A HREF="http://<?=$_SERVER['HTTP_HOST']?>/hotelbooking/index.php/backend/hotel/edit/<?=$displayHotel[$i]['hotel_id']?>"><?=$displayHotel[$i]['hotel_name']?></A>
													<? $temp_hotel_ID = $displayHotel[$i]['hotel_id']; ?>
													<? $flag = true; ?>
											<? endif; ?>
									</td>
									<td>
											<?=($i==0)? '<A HREF="http://'.$_SERVER["HTTP_HOST"].'/hotelbooking/index.php/backend/hotel/edit/room.'.str_replace('=', '', $this->encrypt->encode($displayHotel[$i]["rt_id"])).'">'.$displayHotel[$i]["rt_name"].'</A>' : '' ?>
											<? if($displayHotel[$i]['rt_id'] != $temp_room_ID): ?>
													<A HREF="http://<?=$_SERVER['HTTP_HOST']?>/hotelbooking/index.php/backend/hotel/edit/room.<?=str_replace('=', '', $this->encrypt->encode($displayHotel[$i]['rt_id']))?>"><?=$displayHotel[$i]['rt_name']?></A>
													<? $temp_room_ID = $displayHotel[$i]['rt_id']; ?>
											
											<? endif; ?>
									</td>
							</tr>
					<?php endfor; ?>
					</table>
			</div>
			<div><A HREF="http://<?=$_SERVER['HTTP_HOST']?>/hotelbooking/index.php/backend/admin/add_language">add language</A></div>
		
<? endif; ?>